#include<bits/stdc++.h>
#define int long long 
using namespace std;
const int Maxn = 300, mod = 1e9 + 7;
char a[Maxn][Maxn], b[Maxn];
int n, m;
int sum[Maxn];
signed main(){
	ios::sync_with_stdio(false);
	freopen("disanti.in", "r", stdin);
	freopen("disanti.out", "w", stdout);
	cin >> n >> m;
	for(int i = 1 ; i <= n ; i++)
		for(int j = 1 ; j <= m ; j++)
			cin >> a[i][j];
	if(n == 1){
		sum[1] = 1;
		sum[2] = 2;
		for(int i = 3 ; i <= m ; i++){
			sum[i] = 1;
			for(int j = 1 ; j < i ; j++) sum[i] = (sum[i] + sum[j]) % mod;
		}
		for(int i = 1 ; i <= m ; i++){
			int ans = 1;
			for(int j = 1 ; j <= m ; j++){
				if(j != i) b[j] = a[1][j];
				else{  
					if(a[1][j] == '0') b[j] = '1';
					else b[j] = '0';
				}
			}
			int cnt = 0;
			for(int j = 1 ; j <= m ; j++){
				cnt++;
				if(b[j] != b[j + 1] || j == m){
					ans = (ans * sum[cnt]) % mod;
					cnt = 0;
				}
			}
			cout << ans << " ";
		}
	}
	cerr << clock() * 1.0 / CLOCKS_PER_SEC << "sec" << '\n';
	return 0;
}